package org.dolirio.soft.hib.dao;

import java.io.Serializable;
import java.util.List;

import org.dolirio.soft.model.Election;
import org.dolirio.soft.util.BeanSource;
import org.springframework.beans.factory.InitializingBean;

public class ElectionDAO implements InitializingBean {

	private GenericHibernateDAO<Election> genericHibDAO;

	public static ElectionDAO get() {

		return (ElectionDAO) BeanSource.getBean("ElectionDAO");
	}

	public void delete(Election t) {
		genericHibDAO.delete(t);
	}

	public List<Election> getByAttribute(String attr, Serializable value) {
		return genericHibDAO.getByAttribute(attr, value);
	}

	public Election retrieve(Serializable id) {
		return genericHibDAO.retrieve(id);
	}

	public Serializable save(Election t) {
		return genericHibDAO.save(t);
	}

	public void update(Election t) {
		genericHibDAO.update(t);
	}

	public void setGenericHibDAO(GenericHibernateDAO<Election> genericHibDAO) {
		this.genericHibDAO = genericHibDAO;
	}

	@Override
	public void afterPropertiesSet() throws Exception {

		genericHibDAO.setClazz(Election.class);
	}
}
